package com.cnt.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cnt.entity.RequestMoney;
import com.cnt.vo.RequestMoneyVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface RequestMoneyDao extends BaseMapper<RequestMoney> {
    @Select("select request_money_id,donation_id,time,money,reason,status,evaluate from request_money where donation_id=#{donationId}")
    List<RequestMoney> queryPersonByDonationId(Integer donationId);
    @Select("select request_money_id,donation_id,time,money,reason,status,evaluate from request_money where donation_id=#{donationId} and status=2")
    List<RequestMoney> queryByDonationId(Integer donationId);
    @Select("select sum(money) from request_money where donation_id=#{donationId} and status=0")
    int getMoneyByDonationId(Integer donationId);
    @Select("SELECT * FROM request_money JOIN donations ON request_money.donation_id = donations.donation_id")
    List<RequestMoneyVo> getRequestMoneyVo();
}
